﻿using SalesSys.Comm.DAL;
using SalesSys.DAL.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SalesSys.DAL.Models
{
    /*
     * 供应商信息收集相关
     */
    class SupplierInfo
    {
    }

    /// <summary>
    /// 仓库历史
    /// </summary>
    public class DepotHistroy : DbEntityBase<int>
    {

        /// <summary>
        /// 供应商
        /// </summary>
        public virtual Provider Provider { get; set; }

        /// <summary>
        /// 仓库编号
        /// </summary>
        public Guid DepotId { get; set; }

        /// <summary>
        /// 商品
        /// </summary>
        public virtual Commodity Commodity { get; set; }

        /// <summary>
        /// 商品编号
        /// </summary>
        public Guid CommodityId { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 库存，t
        /// </summary>
        [DecimalPrecision(18, 3)]
        public decimal Amount { get; set; }

        /// <summary>
        /// 价格库存最后更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; }
        #region IDbEntity 成员

        public object[] GetKeyValues()
        {
            return new object[] { DepotId, CommodityId };
        }

        public void SetKeyValues(object[] keyValues)
        {
            DepotId = (Guid)keyValues[0];
            CommodityId = (Guid)keyValues[1];

        }

        #endregion
        public class Mapper : BaseMapToCfg<DepotHistroy>
        {
            public Mapper()
            {
                ToTable("sal_DepotCommodity_histroy");
            }
        }
    }
}

